package cn.gdut.chengcai.enums;

/**
 * 会员账户类型
 *
 * @author gates
 *
 */
public enum MemberType {
	UNKNOWNED(0), // 未知
	MEMBER_PERSONAL(1), // 个人
	MEMBER_COMPANY(2), // 企业
	MEMBER_TEACHER(3);// 讲师

	private int value;

	private MemberType(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public String getString() {
		return getString(this.value);
	}

	public static String getString(Integer value) {
		String result = "未知";
		if (null == value) {
			return result;
		}
		if (value == MemberType.MEMBER_PERSONAL.getValue()) {
			result = "个人";
		} else if (value == MemberType.MEMBER_COMPANY.getValue()) {
			result = "企业";
		} else if (value == MemberType.MEMBER_TEACHER.getValue()) {
			result = "讲师";
		}
		return result;
	}

	public static Integer getInteger(String value) {
		Integer result = 0;
		if (value.equals("个人")) {
			result = MemberType.MEMBER_PERSONAL.getValue();
		} else if (value.equals("企业")) {
			result = MemberType.MEMBER_COMPANY.getValue();
		} else if (value.equals("讲师")) {
			result = MemberType.MEMBER_TEACHER.getValue();
		}
		return result;
	}
}